built for Linux and macOS
should work on Windows as well
(as soon as we figure out portaudio and libsndfile)
double process_delay(delay_line_s *dl, double x)
{
double y = dl->delay[dl->ptr];
dl->delay[dl->ptr++] = x + (y * dl->gain);
if (dl->ptr >= dl->delay_samples) {
dl->ptr -= dl->delay_samples;
}
return y;
}
const double ER_TAPS[18] = {
0.0043, 0.0215, 0.0225, 0.0268, 0.0270, 0.0298, 0.0458, 0.0485, 0.0572,
0.0587, 0.0595, 0.0612, 0.0707, 0.0708, 0.0726, 0.0741, 0.0753, 0.0797
};
const double ER_GAINS[18] = {
0.841, 0.504, 0.491, 0.379, 0.380, 0.346, 0.289, 0.272, 0.192,
0.193, 0.217, 0.181, 0.180, 0.181, 0.176, 0.142, 0.167, 0.134
};
https://github.com/keithhearne/VSTPlugins/blob/master/MoorerReverb/Source/ERTapDelayLine.h
double process_allpass(delay_line_s *dl, double x)
{
double y = dl->delay[dl->ptr];
dl->delay[dl->ptr++] =
(dl->gain + (x + (y * dl->gain))) /
(1 + (dl->gain * (x + (y * dl->gain))));
if (dl->ptr >= dl->delay_samples) {
dl->ptr -= dl->delay_samples;
}
return y;
}
double process_comb(delay_line_s *dl, double x)
{
double y = dl->delay[dl->ptr];
dl->delay[dl->ptr++] =
(dl->gain) /
(1 + (dl->gain * (x + (y * dl->gain))));
if (dl->ptr >= dl->delay_samples) {
dl->ptr -= dl->delay_samples;
}
return y;
}
void try_moorer(double *samples, SF_INFO *sfinfo)
{
double *early_reflections
=calloc(sizeof(double), sfinfo->channels*sfinfo->frames);
memccpy(early_reflections, samples,
sfinfo->channels*sfinfo->frames, sizeof(double)
);
just_delays(early_reflections, sfinfo);
double *late_reflections
=calloc(sizeof(double), sfinfo->channels*sfinfo->frames);
memccpy(late_reflections, early_reflections,
sfinfo->channels*sfinfo->frames, sizeof(double)
);
comb_filters(late_reflections, sfinfo);
allpass(late_reflections, sfinfo);
double dry=0.3;
double wet=1-dry;
for(uint32_t i=0; i<sfinfo->channels*sfinfo->frames;i++){
samples[i] = samples[i] * dry + late_reflections[i]*wet;
}
free(early_reflections);
free(late_reflections);
}
Audio("../audio/Epic Sax Guy.wav")
Audio("../build/epic.wav")